#ifndef __KERNEL__OBJECT__HPP__
# define __KERNEL__OBJECT__HPP__

# include "types.hpp"

# include <boost/shared_ptr.hpp>
# include <boost/cstdint.hpp>
# include <boost/noncopyable.hpp>

# include <vector>
# include <string>
# include <sstream>

class motion_state_t;

/**
 * @brief Describes class of 3D object. Contains fully object description.
 * @remarks
 *      It used to instantiate concrete objects of world.
 *      This class is creating once and would be used for all world objects of corresponding class.
 *      Owns resources for world object class and describes correspondence from mesh to material.
 */
struct object_class_t : private boost::noncopyable
{

    /**
     * @brief Creates world object class description.
     */
    static boost::shared_ptr<object_class_t> create(boost::shared_ptr<std::stringstream> &stream);

    std::string name_;

    std::vector<std::string> mesh_;
    std::vector<std::string> texture_;
    std::vector<std::string> material_;

    std::vector<std::pair<std::string, std::string> > structure_;

    bool is_resources_loaded_;

    scalar_t mass_;
private:
    object_class_t();
};

/**
 * @brief Describes concrete instantiation of world 3D object.
 */
struct object_t : private boost::noncopyable
{

    /**
     * @brief Function return unique identifier.
     * @remarks
     *      Not thread-safe, think it will will be enough, cause
     *      all object would to be created by one thread.
     */
    static boost::uint64_t gen_uid();

    void move_to(vector3_t &pos);

    boost::uint64_t ID;
    boost::shared_ptr<object_class_t> class_;

    boost::shared_ptr<motion_state_t> motion_;

    virtual ~object_t();
    object_t();

private:

    static boost::uint64_t id_counter;
};

#endif //__KERNEL__OBJECT__HPP__
